﻿using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using TTGameEngine;

/*
 * LocalBuffDatas
 *
 *
 *
 * 依赖：
 *
 * ！不写重复代码！
 * @author TTun
 * @date 8/31/2017 7:37:41 PM
 */
[CustomEditor(typeof(LocalBuffDatas))]
public class LocalBuffDatasEditor : Editor {
    private SerializedObject scriptObj;
    private LocalBuffDatas obj;

    SerializedProperty buffDataProp;

    void OnEnable() {
        scriptObj = new SerializedObject(target);
        obj = target as LocalBuffDatas;

    }

    bool[] FoldoutFlag = new bool[10];

    public override void OnInspectorGUI() {

        scriptObj.Update();

//         for(int i = 0; i < obj.m_localBuffdatas.Length; i++) {
//             buffDataProp = scriptObj.FindProperty("m_localBuffdatas.Array.data[" + i + "]");
//             BaseBuffData buffData = obj.m_localBuffdatas[i];
//             switch(buffData.m_buffType) {
//                 case BuffType.HPBuff: {
//                         HPBuffData typeBuffData = buffData as HPBuffData;
//                         if(typeBuffData != null) {
//                             EditorGUILayout.PropertyField(buffDataProp);
//                             FoldoutFlag[0] = ValueChangeField(typeBuffData.m_hpChange, "hpChange", FoldoutFlag[0]);
//                             FoldoutFlag[1] = ValueChangeField(typeBuffData.m_hpChangeDot, "hpChangeDot", FoldoutFlag[1]);
//                         }
//                     }
//                     break;
//                 case BuffType.PropBuff: {
//                         PropBuffData typeBuffData = buffData as PropBuffData;
//                         //EditorGUILayout.ObjectField(buffData.m_buffType.ToString(), (Object)typeBuffData, typeof(PropBuffData), false);
//                     }
//                     break;
//             }
//
//         }


        //EditorGUILayout.PropertyField(nameCn,);

        base.OnInspectorGUI();
        scriptObj.ApplyModifiedProperties();
    }

//     bool ValueChangeField(ValueChange obj, string name, bool isFoldout) {
//         isFoldout = EditorGUILayout.Foldout(isFoldout, name);
//         if(isFoldout) {
//             obj.changePrecent = EditorGUILayout.FloatField("changePrecent", obj.changePrecent);
//             obj.changeValue = EditorGUILayout.FloatField("changeValue", obj.changeValue);
//             obj.changeCount = EditorGUILayout.IntField("changeCount", obj.changeCount);
//         }
//         return isFoldout;
//     }
//
//     bool PropChangeField(PropChange obj, string name, bool isFoldout) {
//         isFoldout = EditorGUILayout.Foldout(isFoldout, name);
//         if(isFoldout) {
//             obj.propID = EditorGUILayout.IntField("propID", obj.propID);
//             obj.changePrecent = EditorGUILayout.FloatField("changePrecent", obj.changePrecent);
//             obj.changeValue = EditorGUILayout.FloatField("changeValue", obj.changeValue);
//             obj.isTemporary = EditorGUILayout.Toggle("isTemporary", obj.isTemporary);
//         }
//         return isFoldout;
//     }



}

